package com.ahm.controller;

import com.ahm.pojo.Product;
import com.ahm.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author anhaimeng
 * @title: ProductController
 * @projectName feign-demo
 * @description: TODO
 * @date 2021/10/1917:40
 */
/*功能描述
 * @author ahm
 */
@RestController
@RequestMapping("product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @RequestMapping("list")
    public List<Product> selectAllProduct(){
        return productService.selectAllProduct();
    }

    @GetMapping("{id}")
    public Product selectProductById(@PathVariable Integer id){
        return productService.selectById(id);
    }


    @PostMapping("save")
    public Map<String,Object> saveProduct(@RequestBody Product product){
        return productService.saveProduct(product);
    }



    @GetMapping("getProduct")
    public Product getProduct(@RequestBody Product product){
        return productService.getProduct(product);
    }


}
